#Learn Pain Less's RSS Feed
Explore tagged Tumblr posts
Text
#learn pain less#flutter login#learn pain less's rss feed#google flutter#flutter security#flutter#latest#latest tech
0 notes
Text
#learn pain less#flutter#learn pain less's rss feed#blog#flutter login#firebase auth#provider state management
0 notes
Link
How to use Text To Speech inside RecyclerView in Android
What is TTS (Text To Speech)?
TSS or Text To Speech is library provided by Android, which is used to convert any word into voice. This means it can speak any word or phrase provided to this library.
So if you are creating Android Application which require some speaking words then you don’t need to record voice and play inside your application. You can simply pass your words to this library and it will do rest of the things.
We will use android.speech.tts.TextToSpeech library to convert our Strings into voice.
Overview to TTS
First step is to create instance of TextToSpeech.
Pass context to TextToSpeech’s contructor and Callback (which will be called when TextToSpeech will ready).
There is 3rd optional parameter which is “engine” which is used to pass custom TextToSpeech engine. (eg. Samsung TTS etc.).
After creating instance call speak() function from instance and it will speak the provided string.
You can also specify language of your text to TextToSpeech library.
Example Project:
TextToSpeech inside RecyclerView:
Code of MainActivity.kt
Code of activity_main.xml
Code of SpeechAdapter.kt
Code of adapter_item_speech.xml
Full Source Code
SpeechTextRecyclerView on Github
Star this github repository and Share with your friends as well.
via Learn Pain Less's RSS Feed
0 notes
Link
EditText editable is deprecated How to use inputType in Android
If you are working in non editable EditText, then you may notice that now its showing warning in xml layout file, Because android:editable is now deprecated in Android. And it will be removed in upcoming version of android. And if you navigate to official website then they will suggest you to use android:inputType instead of android:editable. But they haven’t explained that how to use android:inputType to disable input in EditText.
So here is solution:
Make EditText non editable in Android
First method:
first method is using android:inputType which is suggested by official android team. To use this just set android:inputType="none" and it will become non editable.
Second method:
In you xml code set focusable="false", android:clickable="false" and android:cursorVisible="false" and this will make your EditText treat like non editable.
for example
in XML
<EditText android:id="@+id/myEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Hint" android:focusable="false" android:clickable="false" android:cursorVisible="false" />
Third method:
If you still want to use editable property then you can set this from Java or Kotlin code.
for example
In Java
EditText et = findViewById(R.id.myEditText); et.setEnabled(false);
In Kotlin
myEditText.isEnabled = false
It depends on you that which method will you preffer. Write in comments which method you like and why so other users can take benefit of this.
via Learn Pain Less's RSS Feed
0 notes